<!DOCTYPE html>
<body>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>

<textarea style="width:400px; height:400px" id="textInputID">
Some text
</textarea>

<script>
function drag(startX, startY, destX, destY, callback) {
  chrome.gpuBenchmarking.pointerActionSequence([{source: 'mouse', actions:[
    {name: 'pointerDown', x: startX, y: startY},
    {name: 'pointerMove', x: destX, y: destY},
    {name: 'pointerUp'}]}],
    callback);
}

var t = async_test('Test for resizing the TEXTAREA below its min intrinsic size.');
t.step(() => {
  assert_own_property(window, 'chrome');
  assert_own_property(chrome, 'gpuBenchmarking');

  var textArea = document.getElementById("textInputID");
  var startX = textArea.offsetLeft + 400;
  var startY = textArea.offsetTop + 400;
  drag(startX, startY, startX - 395, startY - 395, t.step_func_done(() => {
    // The min-width/min-height includes padding and border and width/height
    // does not include padding and border.
    // So when we set say min-width = 200px it means actual minimum width of box
    // to be 194px (as 2px padding and 1px border on all side).
    // Hence the condition check here for 9px as default minimum size for
    // resizing is 15x15.
    assert_equals(textArea.style.width, '9px');
    assert_equals(textArea.style.height, '9px');
  }));
});
</script>
</body>
